<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>javascript 阶段</title>
</head>
<body>


    <script>
        // 创建div标签
        var divCreate = document.createElement("div");

        var divCreate_1 = document.createElement("div");

        // 设置样式
        divCreate.style.backgroundColor = "red";
        divCreate.style.backgroundColor = "red";
        // 设置类名
        var classname_1 = document.getElementsByClassName("box");
        divCreate.className = "box";
        // 设置id
        var classname_1 = document.getElementById("box");
        divCreate.id = "demo";
        // 设置文本(超文本)
        // divCreate.innerHTML = "<b>hello world</b>";
        // 设置文本(纯文本)
        divCreate.innerText = "<b>hello world</b>";
        var cName = divCreate.className ;//获取类名
        var id = divCreate.id ;       //获取id
        var html = divCreate.innerHTML ;//获取超文本
        var text = divCreate.innerText ;//获取纯文本

        console.log(divCreate);// 打印创建的div标签


    </script>
</body>
</html>